# eric7.WebBrowser.Download.DownloadManager

Module implementing the download manager class.

### Global Attributes

DownloadManagerDefaultRemovePolicy

### Classes

DownloadManager | Class implementing the download manager.
DownloadManagerRemovePolicy | Class defining the remove policies.

### Functions

None

## DownloadManager

Class implementing the download manager.

### Signals

downloadsCountChanged()
  emitted to indicate a change of the count of download items

### Derived from

QDialog, Ui_DownloadManager

### Class Attributes

UpdateTimerTimeout

### Class Methods

None

### Methods

DownloadManager | Constructor
__addItem | Private method to add a download to the list of downloads.
__closeDownloadTab | Private method to close an empty tab, that was opened only for loading the download URL.
__contextMenuCancel | Private method to cancel the current download.
__contextMenuCopyLink | Private method to copy the download link to the clipboard.
__contextMenuGotoPage | Private method to open the download page.
__contextMenuOpen | Private method to open the downloaded file.
__contextMenuOpenFolder | Private method to open the folder containing the downloaded file.
__contextMenuRemoveSelected | Private method to remove the selected downloads from the list.
__contextMenuSelectAll | Private method to select all downloads.
__currentItem | Private method to get a reference to the current item.
__customContextMenuRequested | Private slot to handle the context menu request for the bookmarks tree.
__finished | Private slot to handle a finished download.
__load | Private method to load the download settings.
__startUpdateTimer | Private slot to start the update timer.
__stopUpdateTimer | Private slot to stop the update timer.
__taskbarButton | Private method to get a reference to the task bar button (Windows only).
__testWebBrowserView | Private method to test a web browser view against an URL.
__updateRow | Private slot to update a download item.
activeDownloadsCount | Public method to get the number of active downloads.
allowQuit | Public method to check, if it is ok to quit.
changeOccurred | Public method to signal a change.
cleanup | Public slot to cleanup the downloads.
closeEvent | Protected event handler for the close event.
download | Public method to download a file.
downloadDirectory | Public method to get the current download directory.
downloads | Public method to get a reference to the downloads.
downloadsCount | Public method to get the number of downloads.
on_cleanupButton_clicked | Private slot to cleanup the downloads.
removePolicy | Public method to get the remove policy.
save | Public method to save the download settings.
setDownloadDirectory | Public method to set the current download directory.
setRemovePolicy | Public method to set the remove policy.
show | Public slot to show the download manager dialog.
shutdown | Public method to stop the download manager.
timerEvent | Protected event handler for timer events.

### Static Methods

None

#### DownloadManager (Constructor)

DownloadManager(parent=None)

Constructor

parent (QWidget)
  reference to the parent widget

#### DownloadManager.__addItem

__addItem(itm, append=False)

Private method to add a download to the list of downloads.

itm (DownloadItem)
  reference to the download item
append (bool)
  flag indicating to append the item

#### DownloadManager.__closeDownloadTab

__closeDownloadTab(url)

Private method to close an empty tab, that was opened only for loading the download URL.

url (QUrl)
  download URL

#### DownloadManager.__contextMenuCancel

__contextMenuCancel()

Private method to cancel the current download.

#### DownloadManager.__contextMenuCopyLink

__contextMenuCopyLink()

Private method to copy the download link to the clipboard.

#### DownloadManager.__contextMenuGotoPage

__contextMenuGotoPage()

Private method to open the download page.

#### DownloadManager.__contextMenuOpen

__contextMenuOpen()

Private method to open the downloaded file.

#### DownloadManager.__contextMenuOpenFolder

__contextMenuOpenFolder()

Private method to open the folder containing the downloaded file.

#### DownloadManager.__contextMenuRemoveSelected

__contextMenuRemoveSelected()

Private method to remove the selected downloads from the list.

#### DownloadManager.__contextMenuSelectAll

__contextMenuSelectAll()

Private method to select all downloads.

#### DownloadManager.__currentItem

__currentItem()

Private method to get a reference to the current item.

Return:
  reference to the current item

Return Type:
  DownloadItem

#### DownloadManager.__customContextMenuRequested

__customContextMenuRequested(pos)

Private slot to handle the context menu request for the bookmarks tree.

pos (QPoint)
  position the context menu was requested

#### DownloadManager.__finished

__finished(success)

Private slot to handle a finished download.

success (bool)
  flag indicating a successful download

#### DownloadManager.__load

__load()

Private method to load the download settings.

#### DownloadManager.__startUpdateTimer

__startUpdateTimer()

Private slot to start the update timer.

#### DownloadManager.__stopUpdateTimer

__stopUpdateTimer()

Private slot to stop the update timer.

#### DownloadManager.__taskbarButton

__taskbarButton()

Private method to get a reference to the task bar button (Windows only).

Return:
  reference to the task bar button

Return Type:
  QWinTaskbarButton or None

#### DownloadManager.__testWebBrowserView

__testWebBrowserView(view, url)

Private method to test a web browser view against an URL.

view (WebBrowserView)
  reference to the web browser view to be tested
url (QUrl)
  URL to test against

Return:
  flag indicating, that the view is the one for the URL

Return Type:
  bool

#### DownloadManager.__updateRow

__updateRow(itm)

Private slot to update a download item.

itm (DownloadItem)
  reference to the download item

#### DownloadManager.activeDownloadsCount

activeDownloadsCount()

Public method to get the number of active downloads.

Return:
  number of active downloads

Return Type:
  int

#### DownloadManager.allowQuit

allowQuit()

Public method to check, if it is ok to quit.

Return:
  flag indicating allowance to quit

Return Type:
  bool

#### DownloadManager.changeOccurred

changeOccurred()

Public method to signal a change.

#### DownloadManager.cleanup

cleanup()

Public slot to cleanup the downloads.

#### DownloadManager.closeEvent

closeEvent(evt)

Protected event handler for the close event.

evt (QCloseEvent)
  reference to the close event

#### DownloadManager.download

download(downloadRequest)

Public method to download a file.

downloadRequest (QWebEngineDownloadRequest)
  reference to the download object containing the download data.

#### DownloadManager.downloadDirectory

downloadDirectory()

Public method to get the current download directory.

Return:
  current download directory

Return Type:
  str

#### DownloadManager.downloads

downloads()

Public method to get a reference to the downloads.

Return:
  reference to the downloads

Return Type:
  list of DownloadItem

#### DownloadManager.downloadsCount

downloadsCount()

Public method to get the number of downloads.

Return:
  number of downloads

Return Type:
  int

#### DownloadManager.on_cleanupButton_clicked

on_cleanupButton_clicked()

Private slot to cleanup the downloads.

#### DownloadManager.removePolicy

removePolicy()

Public method to get the remove policy.

Return:
  remove policy

Return Type:
  DownloadManagerRemovePolicy

#### DownloadManager.save

save()

Public method to save the download settings.

#### DownloadManager.setDownloadDirectory

setDownloadDirectory(directory)

Public method to set the current download directory.

directory (str)
  current download directory

#### DownloadManager.setRemovePolicy

setRemovePolicy(policy)

Public method to set the remove policy.

policy (DownloadManagerRemovePolicy)
  remove policy to be set

#### DownloadManager.show

show()

Public slot to show the download manager dialog.

#### DownloadManager.shutdown

shutdown()

Public method to stop the download manager.

#### DownloadManager.timerEvent

timerEvent(evt)

Protected event handler for timer events.

evt (QTimerEvent)
  reference to the timer event

Up

## DownloadManagerRemovePolicy

Class defining the remove policies.

### Derived from

enum.Enum

### Class Attributes

Exit
Never
SuccessfullDownload

### Class Methods

None

### Methods

None

### Static Methods

None

Up